<script type="text/javascript">
    $(document).ready(function() {
        autocomplate('form-suburbs');
        $("#address-suburb").autocomplete({
            delay: 100,
            source: function(request, response) {
                $.ajax({
                    url: "<?php echo site_url('home/ajax_search?part=') ?>" + request.term,
                    dataType: 'json',
                    success: function(json) {
                        response($.map(json, function(item, key) {
                            return {
                                label: item,
                                values: key
                            }
                        }));
                        return false
                    }
                });
            },
            select: function(event, ui) {
                $("#keyword_1").val(ui.item.values);
            },
            focus: function(event, ui) {
                return false;
            }
        });


    })
</script>
<div id="main" class="">

    <div id="page-body" class="selling">
        <?php if (!empty($usermessage)) { ?>
            <div id="msgContainer">
                <div id="msgdesc-<?php echo $usermessage[0] ?>">
                    <?php
                    if (isset($usermessage)) {
                        if ($usermessage[0] == "error") {

                            echo $usermessage[1];
                            ?>
                            <script type="text/javascript">
                                $(document).ready(function() {

                                    var content = $("#appraisal-request-form");
                                    var trigger = $("#appraisal-request-form-trigger");
                                    var cancel = $("#appraisal-request-cancel")

                                    content.slideDown(5);
                                    trigger.addClass('active');

                                    cancel.click(function(e) {
                                        e.preventDefault();
                                        if (content.is(":visible")) {
                                            content.slideUp(500);
                                            trigger.removeClass('active');
                                        }
                                    });


                                })
                            </script>
                            <?php
                        } else { // if error
                            echo $usermessage[1];
                        }
                    }
                    // } // if isset
                    ?>
                </div>
            </div>

        <?php } ?>
        <h1>LOOKING TO SELL WITH<br/> GO GECKO?</h1>
        <p>A Go Gecko sales agent will visit your home and give you comprehensive information so you can make an educated and informed decision on how you may wish to sell your home. You will receive an upfront and honest take on the market; Capped Commissions and 100% service to make sure we sell your home.  So for a Fair Go - Go Gecko!</p>

        <a id="appraisal-request-form-trigger" class="link-button" href="#">Free Market Appraisal</a>
        <div id="appraisal-request-form" style="display:none;" class="clearfix" enquire-target="">
            <div class="form-divider"></div>
            <h1 class="gogecko-orange">Appraisal Request</h2>

                <div id="appraisal-request-form-content">
                    <form class="cform appraisal-sale" method="post" id="appraisal-sale-rent">
                        <div class="form clearfix" id="appraisal-request-form">
                            <div id="form-error-msg"></div>
                            <input style="display:none;" name="agencyID" value=""></input>
                            <ol class="cf-ol">
                                <li class="textonly"><h2 class="gogecko-orange">Enter Your Suburb</h2></li>
                                <li class=""><label for="form-suburbs"><span>Suburb*</span></label>
                                    <input type="text" aria-haspopup="true" aria-autocomplete="list" role="textbox" autocomplete="off"
                                           id="form-suburbs" class="single ui-autocomplete-input" value="<?php echo!empty($post['suburb']) ? $post['suburb'] : '' ?>" name="suburb" placeholder="Enter Suburb"
                                           />
                                    <div id="results-suburbs"></div>
                                </li>
                                <li class="textonly"><h2 class="gogecko-orange">Applicant Details</h2></li>
                                <li class=""><label for="name"><span>Your Name * </span></label>
                                    <input type="text" id="name" class="single fldrequired" placeholder="Enter Name" value="<?php echo!empty($post['name']) ? $post['name'] : '' ?>" name="name"
                                           onfocus="clearField(this)" onblur="setField(this)" />
                                    <span class="reqtxt"></span></li>
                                <li class=""><label for="phone"><span>Contact Number* </span></label>
                                    <input type="text" id="phone" class="single fldrequired" placeholder="Enter Phone Number"  value="<?php echo!empty($post['phone']) ? $post['phone'] : '' ?>" name="phone"
                                           onfocus="clearField(this)" onblur="setField(this)" />
                                    <span class="reqtxt"></span></li>
                                <li class=""><label for="mobile"><span>Mobile </span></label>
                                    <input type="text" id="mobile" class="single" placeholder="Enter Mobile Number" value="<?php echo!empty($post['mobile']) ? $post['mobile'] : '' ?>" name="mobile"
                                           onfocus="clearField(this)" onblur="setField(this)" />
                                </li>
                                <li class=""><label for="emailAddress"><span>Email * </span></label>
                                    <input type="text" id="emailAddress" class="single fldemail fldrequired" placeholder="Enter Email Address" value="<?php echo!empty($post['email']) ? $post['email'] : '' ?>" name="email"
                                           onfocus="clearField(this)" onblur="setField(this)" />
                                    <span class="emailreqtxt"></span></li>
                                <li class="textonly" ><h2 class="gogecko-orange">Property Address</h2></li>
                                <li class="" ><label for="address"><span>Address * </span></label>
                                    <input type="text" id="address-street" class="single" placeholder="Number and Street Name"  value="<?php echo!empty($post['address']) ? $post['address'] : '' ?>" name="address"
                                           onfocus="clearField(this)" onblur="setField(this)" />
                                    <input type="text" id="address-suburb" class="single" placeholder ="Suburb, State and Post Code" value="<?php echo!empty($post['suburb']) ? $post['suburb'] : '' ?>" name="address_suburb"
                                           onfocus="clearField(this)" onblur="setField(this)" />
                                    <input type="hidden" id="keyword_1" value="<?php echo!empty($post['address_suburb_id']) ? $post['address_suburb_id'] : '' ?>" name="address_suburb_id">

                                    <div id="results-suburbs"></div>
                                </li>
                                <li class="textonly" ><h2 class="gogecko-orange">Property Details</h2></li>

                                <li class="" ><label for="propertyType"><span>  Type  </span></label>
                                    <select name="propertyType" id="propertyType" name="property" class="cformselect fldrequired" >
                                        <option <?php echo (!empty($post['propertyType']) && ($post['propertyType'] == 'any')) ? 'Selected' : '' ?> value="any">Any</option>
                                        <option <?php echo (!empty($post['propertyType']) && ($post['propertyType'] == 'Acreage/Semi Rural')) ? 'Selected' : '' ?> value="Acreage/Semi Rural">Acreage/Semi Rural</option>
                                        <option <?php echo (!empty($post['propertyType']) && ($post['propertyType'] == 'Apartment')) ? 'Selected' : '' ?> value="Apartment">Apartment</option>
                                        <option <?php echo (!empty($post['propertyType']) && ($post['propertyType'] == 'Block of Units')) ? 'Selected' : '' ?> value="Block of Units">Block of Units</option>
                                        <option <?php echo (!empty($post['propertyType']) && ($post['propertyType'] == 'Colonial')) ? 'Selected' : '' ?> value="Colonial">Colonial</option>
                                        <option <?php echo (!empty($post['propertyType']) && ($post['propertyType'] == 'Development')) ? 'Selected' : '' ?> value="Development">Development</option>
                                        <option <?php echo (!empty($post['propertyType']) && ($post['propertyType'] == 'Duplex')) ? 'Selected' : '' ?> value="Duplex">Duplex</option>
                                        <option <?php echo (!empty($post['propertyType']) && ($post['propertyType'] == 'Federation')) ? 'Selected' : '' ?> value="Federation">Federation</option>
                                        <option <?php echo (!empty($post['propertyType']) && ($post['propertyType'] == 'Home &amp; Office')) ? 'Selected' : '' ?> value="Home &amp; Office">Home &amp; Office</option>
                                        <option <?php echo (!empty($post['propertyType']) && ($post['propertyType'] == 'House')) ? 'Selected' : '' ?> value="House">House</option>
                                        <option <?php echo (!empty($post['propertyType']) && ($post['propertyType'] == 'House &amp; Land Package')) ? 'Selected' : '' ?> value="House &amp; Land Package">House &amp; Land Package</option>
                                        <option <?php echo (!empty($post['propertyType']) && ($post['propertyType'] == 'Investment')) ? 'Selected' : '' ?> value="Investment">Investment</option>
                                        <option <?php echo (!empty($post['propertyType']) && ($post['propertyType'] == 'Project')) ? 'Selected' : '' ?> value="Project">Project</option>
                                        <option <?php echo (!empty($post['propertyType']) && ($post['propertyType'] == 'Queenslander')) ? 'Selected' : '' ?> value="Queenslander">Queenslander</option>
                                        <option <?php echo (!empty($post['propertyType']) && ($post['propertyType'] == 'Town House')) ? 'Selected' : '' ?> value="Town House">Town House</option>
                                        <option <?php echo (!empty($post['propertyType']) && ($post['propertyType'] == 'Unit')) ? 'Selected' : '' ?> value="Unit">Unit</option>
                                        <option <?php echo (!empty($post['propertyType']) && ($post['propertyType'] == 'Vacant Land')) ? 'Selected' : '' ?> value="Vacant Land">Vacant Land</option>
                                        <option <?php echo (!empty($post['propertyType']) && ($post['propertyType'] == 'Villa')) ? 'Selected' : '' ?> value="Villa">Villa</option>
                                        <option <?php echo (!empty($post['propertyType']) && ($post['propertyType'] == 'Waterfront - Beach')) ? 'Selected' : '' ?> value="Waterfront - Beach">Waterfront - Beach</option>
                                        <option <?php echo (!empty($post['propertyType']) && ($post['propertyType'] == 'Waterfront - Canal')) ? 'Selected' : '' ?> value="Waterfront - Canal">Waterfront - Canal</option>
                                    </select>
                                    <span class="reqtxt"></span></li>

                                <li class="" ><label for="Bedrooms"><span>Bedrooms </span></label> <select name="bedrooms" id="Bedrooms" class="cformselect">
                                        <option value="any" <?php echo (!empty($post['bedrooms']) && ($post['bedrooms'] == 'any')) ? 'Selected' : '' ?>>Any</option>
                                        <option value="1" <?php echo (!empty($post['bedrooms']) && ($post['bedrooms'] == '1')) ? 'Selected' : '' ?>>1</option>
                                        <option value="2" <?php echo (!empty($post['bedrooms']) && ($post['bedrooms'] == '2')) ? 'Selected' : '' ?>>2</option>
                                        <option value="3" <?php echo (!empty($post['bedrooms']) && ($post['bedrooms'] == '3')) ? 'Selected' : '' ?>>3</option>
                                        <option value="4" <?php echo (!empty($post['bedrooms']) && ($post['bedrooms'] == '4')) ? 'Selected' : '' ?>>4</option>
                                        <option value="5" <?php echo (!empty($post['bedrooms']) && ($post['bedrooms'] == '5')) ? 'Selected' : '' ?>>5</option>
                                        <option value="6" <?php echo (!empty($post['bedrooms']) && ($post['bedrooms'] == '6')) ? 'Selected' : '' ?>>6</option>
                                        <option value="7" <?php echo (!empty($post['bedrooms']) && ($post['bedrooms'] == '7')) ? 'Selected' : '' ?>>7</option>
                                        <option value="8" <?php echo (!empty($post['bedrooms']) && ($post['bedrooms'] == '8')) ? 'Selected' : '' ?>>8</option>
                                        <option value="9" <?php echo (!empty($post['bedrooms']) && ($post['bedrooms'] == '9')) ? 'Selected' : '' ?>>9</option>
                                        <option value="10" <?php echo (!empty($post['bedrooms']) && ($post['bedrooms'] == '10')) ? 'Selected' : '' ?>>10</option>
                                    </select>
                                    <div class="clearer"></div>
                                </li>
                                <li class="" ><label for="Bathrooms"><span>Bathrooms </span></label>
                                    <select name="bathrooms" id="Bathrooms" class="cformselect">
                                        <option value="any" <?php echo (!empty($post['bathrooms']) && ($post['bathrooms'] == 'any')) ? 'Selected' : '' ?>>Any</option>
                                        <option value="1" <?php echo (!empty($post['bathrooms']) && ($post['bathrooms'] == '1')) ? 'Selected' : '' ?>>1</option>
                                        <option value="2" <?php echo (!empty($post['bathrooms']) && ($post['bathrooms'] == '2')) ? 'Selected' : '' ?>>2</option>
                                        <option value="3" <?php echo (!empty($post['bathrooms']) && ($post['bathrooms'] == '3')) ? 'Selected' : '' ?>>3</option>
                                        <option value="4" <?php echo (!empty($post['bathrooms']) && ($post['bathrooms'] == '4')) ? 'Selected' : '' ?>>4</option>
                                        <option value="5" <?php echo (!empty($post['bathrooms']) && ($post['bathrooms'] == '5')) ? 'Selected' : '' ?>>5</option>
                                        <option value="6" <?php echo (!empty($post['bathrooms']) && ($post['bathrooms'] == '6')) ? 'Selected' : '' ?>>6</option>
                                        <option value="7" <?php echo (!empty($post['bathrooms']) && ($post['bathrooms'] == '7')) ? 'Selected' : '' ?>>7</option>
                                        <option value="8" <?php echo (!empty($post['bathrooms']) && ($post['bathrooms'] == '8')) ? 'Selected' : '' ?>>8</option>
                                        <option value="9" <?php echo (!empty($post['bathrooms']) && ($post['bathrooms'] == '9')) ? 'Selected' : '' ?>>9</option>
                                        <option value="10" <?php echo (!empty($post['bathrooms']) && ($post['bathrooms'] == '10')) ? 'Selected' : '' ?>>10</option>
                                    </select>
                                    <div class="clearer"></div>
                                </li>
                                <li class="textonly">
                                    <div class="clearer"></div>
                                    <h2 class="gogecko-orange">How did you hear about us?</h2>
                                </li>
                                <li class="">
                                    <select name="your_hear" id="how-did-you-hear" class="cformselect fldrequired" onChange="showOtherSpecify(this.value)">
                                        <option value="Agent" <?php echo (!empty($post['your_hear']) && ($post['your_hear'] == 'Agent')) ? 'Selected' : '' ?>>Agent</option>
                                        <option value="Radio" <?php echo (!empty($post['your_hear']) && ($post['your_hear'] == 'Radio')) ? 'Selected' : '' ?>>Radio</option>
                                        <option value="Current Landlord" <?php echo (!empty($post['your_hear']) && ($post['your_hear'] == 'Current Landlord')) ? 'Selected' : '' ?>>Current Landlord</option>
                                        <option value="Email" <?php echo (!empty($post['your_hear']) && ($post['your_hear'] == 'Email')) ? 'Selected' : '' ?>>Email</option>
                                        <option value="Facebook" <?php echo (!empty($post['your_hear']) && ($post['your_hear'] == 'Facebook')) ? 'Selected' : '' ?>>Facebook</option>
                                        <option value="Letter Box Flyer" <?php echo (!empty($post['your_hear']) && ($post['your_hear'] == 'Letter Box Flyer')) ? 'Selected' : '' ?>>Letter Box Flyer</option>
                                        <option value="Newsletter" <?php echo (!empty($post['your_hear']) && ($post['your_hear'] == 'Newsletter')) ? 'Selected' : '' ?>>Newsletter</option>
                                        <option value="Newpaper" <?php echo (!empty($post['your_hear']) && ($post['your_hear'] == 'Newpaper')) ? 'Selected' : '' ?>>Newpaper</option>
                                        <option value="Open Home" <?php echo (!empty($post['your_hear']) && ($post['your_hear'] == 'Open Home')) ? 'Selected' : '' ?>>Open Home</option>
                                        <option value="Signage" <?php echo (!empty($post['your_hear']) && ($post['your_hear'] == 'Signage')) ? 'Selected' : '' ?>>Signage</option>
                                        <option value="Other" <?php echo (!empty($post['your_hear']) && ($post['your_hear'] == 'Other')) ? 'Selected' : '' ?>>Other - please specify</option>
                                    </select>
                                    <span class="reqtxt"></span>
                                </li>
                                <li id="how-did-you-hear-other-container" class="" style="display:none">
                                    <input type="text" name="hear_other" id="how-did-you-hear-other" class="single" placeholder="Please specify"  value="<?php echo!empty($post['hear_other']) ? $post['hear_other'] : '' ?>"
                                           onfocus="clearField(this)" onblur="setField(this)" />
                                </li>


                                <li>
                                    <img id="captcha" src="<?php echo site_url('captcha') ?>" alt="CAPTCHA Image" style="display: block"/>
                                    <a href="#" style="color:#F47321;" onclick="document.getElementById('captcha').src = '<?php echo site_url('captcha') ?>?captcha=' + Math.random();
                                    return false">[ Different Image ]</a>
                                <li>
                                    <label for="message">Enter the code above here (Not Case Sensitive):</label>
                                    <input id="captcha_code" name="captcha_code" type="text">
                                </li>

                            </ol>
                            <p class="cf-sb"><input type="submit" value="Submit" class="sendbutton" id="sendbutton3" name="sendbutton3"></p>			</form>
                </div>
                <a id="appraisal-request-cancel" class="form-cancel" href="#">CANCEL</a>
        </div>


    </div>

    <script type="text/javascript">
                                var $REX_AGENCIES = {"Albany Creek": 695, "Aspley - Inner North": 697, "Boondall\/Bracken Ridge - Inner North": 699, "Bribie Island": 701, "Browns Plains - Marsden": 718, "Bundaberg": 702, "Calamvale": 23995, "Carindale - Wynnum": 705, "Clayfield\/Nundah - Inner North": 707, "Coorparoo - Morningside": 711, "Gladstone": 942, "Gold Coast - Nerang": 722, "Grange": 716, "Ipswich": 714, "Mile End - Brighton": 719, "Mount Gravatt": 720, "National Support Office": 988, "Newcastle": 941, "Outer North": 723, "Redlands": 940, "Springfield Lakes": 936, "Springwood \/ Shailer Park": 725, "Toowoomba": 939};
                                (function($) {

                                    // Form dropdown button
                                    $(function() {
                                        var content = $("#appraisal-request-form");
                                        var trigger = $("#appraisal-request-form-trigger");
                                        var cancel = $("#appraisal-request-cancel")

                                        trigger.click(function(e) {
                                            e.preventDefault();
                                            if (content.is(":visible")) {
                                                content.slideUp(500);
                                                trigger.removeClass('active');
                                            } else {
                                                content.slideDown(500);
                                                trigger.addClass('active');
                                            }
                                        });
                                        cancel.click(function(e) {
                                            e.preventDefault();
                                            if (content.is(":visible")) {
                                                content.slideUp(500);
                                                trigger.removeClass('active');
                                            }
                                        });

                                    });

                                })(jQuery);

    </script>
    <div class="clearfix"></div>

</div><!-- #main -->
<script>
    function showOtherSpecify(value) {
        if (value == 'Other') {
            $('#how-did-you-hear-other-container').fadeIn();
        } else {
            $('#how-did-you-hear-other-container').fadeOut();
        }
    }
</script>